package com.ericsson.mhealth.server.model;

import java.util.Date;

import com.google.gson.annotations.SerializedName;
import com.google.template.soy.data.SoyData;

public class MeasurementAtomicUnit extends SoyData {
	
	@SerializedName("x")
	private Date timeStamp;
	
	@SerializedName("y")
	private Double value;
	
	public MeasurementAtomicUnit(Date timeStamp, Double value) {
		this.timeStamp = timeStamp;
		this.value = value;
	}
	
	public Date getTimeStamp() {
		return this.timeStamp;
	}
	
	public void setTimeStamp(Date timeStamp) {
		this.timeStamp = timeStamp;
	}
	
	public Double getValue() {
		return this.value;
	}
	
	public void setValue(Double value) {
		this.value = value;
	}

	@Override
	public boolean equals(Object arg0) {
		if (arg0 instanceof MeasurementAtomicUnit)
			if( ((MeasurementAtomicUnit)arg0).getTimeStamp() == this.getTimeStamp() && ((MeasurementAtomicUnit)arg0).getValue() == this.getValue())
				return true;
		return false;
	}

	@Override
	public boolean toBoolean() {
		if (this.getTimeStamp()!= null && this.getValue()!=null)
			return true;
		return false;
	}

	@Override
	public String toString() {
		String result = "\"timeStamp\":" + this.timeStamp.getTime()+",\"value\":" + this.getValue().toString();
		return result;
	}

}
